﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.EventSystems;

public class SettingUI : MonoBehaviour {
    public GameObject btnBack;
    public GameObject btnAi1Down;
    public GameObject btnAi2Down;
    public GameObject btnExit;

    private void Start()
    {
        EventManager.addEventListener(btnBack, UnityEngine.EventSystems.EventTriggerType.PointerClick, OnBack);
        EventManager.addEventListener(btnAi1Down, UnityEngine.EventSystems.EventTriggerType.PointerClick, OnAi1Execute);
        EventManager.addEventListener(btnAi2Down, UnityEngine.EventSystems.EventTriggerType.PointerClick, OnAi2Execute);
        EventManager.addEventListener(btnExit, UnityEngine.EventSystems.EventTriggerType.PointerClick, OnExit);
    }

    private void OnExit(BaseEventData eventData)
    {
        Application.Quit();
    }

    private void OnBack(BaseEventData eventData)
    {
        Datacenter.BackChess();
    }

    private void OnAi1Execute(BaseEventData eventData)
    {
        Datacenter.OnAiDown(Player.AI_1);
    }

    private void OnAi2Execute(BaseEventData eventData)
    {
        Datacenter.OnAiDown(Player.AI_2);
    }
}
